<template>
    <div class="navmenu">
        <ul>
            <li v-for="(v, i) in navmenulist" :key="i">
                <svg class="icon-font">
                    <use :xlink:href="v.icon"></use>
                </svg>
                <span>{{ v.title }}</span>
            </li>
            <li @click="isAllMethod">
                <svg class="icon-font">
                    <use xlink:href="#icon-gengduo1"></use>
                </svg> 
                <span v-if="isAll==false">更多</span>
                <span v-if="isAll">折叠</span>
            </li>
        </ul>
        <div class="badge">大促</div>
    </div>
</template>
<script>
// import axios from "axios";
import service from "../../api/index";
export default {
    data() {
        return {
            isAll: false,   //表示是否展示所有的类目数据
            navmenulist: []
        }
    },
    mounted() {
        //页面加载完毕, 就要执行这里的内容;
        this.geCategoryList(false);

    },
    methods: {  //在这里可以定义各种方法
        geCategoryList: function (isall) {
            
            var url=`api/PlatformIndex/GetCategoryList/${isall}`;
            service.get(url).then(reponse => { 
                let { success, message, data } = reponse.data; 
                if (success) {
                    this.navmenulist = data;
                }
            }); 
        },
        isAllMethod:function()
        {
            this.isAll = !this.isAll; 
            this.geCategoryList(this.isAll)
        }
    }
}

</script>

